//
//  TellerInfoViewController.m
//  SPDBank
//
//  Created by hanxifeng on 14-12-23.
//  Copyright (c) 2014年 王 焕. All rights reserved.
//

#import "TellerInfoViewController.h"
#import "LHRTLabel.h"
@interface TellerInfoViewController ()

@end

@implementation TellerInfoViewController{
    UIImageView *_tellerImage;//员工头像
    UILabel *_nameLable;//员工姓名
    UILabel *_numberLable;//员工工号
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"浦发银行"];
    _dataDic = [[NSMutableDictionary alloc]init];
    [_dataDic setObject:@"uploads/image/20141224/1419408755.png" forKey:@"head"];
    [_dataDic setObject:@"" forKey:@"msg"];
    [_dataDic setObject:@"123123" forKey:@"name"];
    [_dataDic setObject:@"123123" forKey:@"note"];
    [_dataDic setObject:@"123123" forKey:@"number"];
    [_dataDic setObject:@"0" forKey:@"recode"];
    NSLog(@"%@",_dataDic);
    
    
    
    
    //搭建界面
    [self buildUI];
}

#pragma mark 搭建界面
-(void)buildUI{
    //背景图
    self.view.backgroundColor = [UIColor colorWithPatternImage:IMG(@"g")];
    //二维码
    UIImageView *logo = [[UIImageView alloc]initWithImage:IMG(@"e")];
    CGFloat imageWidth = 1024 - logo.frame.size.width;
    CGFloat imageHeight = 768 - logo.frame.size.height;
    logo.frame = CGRectMake(imageWidth, imageHeight, logo.frame.size.width, logo.frame.size.height);
    [self.view addSubview:logo];
    
    CGFloat width = HEIGH / 4;//三个模块的宽度
    CGFloat paddingLeft = 20;//左侧的间隙
    CGFloat paddingTop = 10;//三个模块距离上一个的距离
    //员工照片背景
    UIImageView *tellerImageBack = [[UIImageView alloc]initWithImage:IMG(@"b")];
    tellerImageBack.frame = CGRectMake(paddingLeft, paddingTop, tellerImageBack.frame.size.width, tellerImageBack.frame.size.height);
    [self.view addSubview:tellerImageBack];
    
    //员工照片尺寸
    CGFloat imageSizeWidth = 388/2;//员工照片的宽
    CGFloat imageSizeHeight = 492/2;//员工照片的高
    _tellerImage = [[UIImageView alloc]initWithFrame:CGRectMake((tellerImageBack.frame.size.width - imageSizeWidth)/2, (tellerImageBack.frame.size.height - imageSizeHeight)/2, imageSizeWidth,imageSizeHeight)];
    [_tellerImage sd_setImageWithURL:[NSURL URLWithString:HTTP_IMG([_dataDic objectForKey:@"head"])] placeholderImage:nil options:SDWebImageRetryFailed];
    [tellerImageBack addSubview:_tellerImage];
    
    //员工信息背景
    UIImageView *infoBackView = [[UIImageView alloc]initWithImage:IMG(@"c")];
    infoBackView.frame = CGRectMake(paddingLeft, paddingTop+CGRectGetMaxY(tellerImageBack.frame), infoBackView.frame.size.width, infoBackView.frame.size.height);
    [self.view addSubview:infoBackView];
    //姓名
    CGFloat heightLable = 40;
    CGFloat paddingToLeft = 20;
    _nameLable = [[UILabel alloc]initWithFrame:CGRectMake(paddingToLeft, 20, 60, heightLable)];
    _nameLable.textColor = RGB(49, 49, 49);
    [_nameLable setFont:[UIFont fontWithName:@"Helvetica-Bold" size:20]];
    _nameLable.text = @"姓名：";
    [infoBackView addSubview:_nameLable];
    //获取的员工姓名
    UILabel *tellerNameLable = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_nameLable.frame), 20, 80, heightLable)];
    tellerNameLable.textColor = RGB(24, 76, 149);
    [tellerNameLable setFont:[UIFont fontWithName:@"Helvetica-Bold" size:20]];
    tellerNameLable.text = [NSString stringWithFormat:@"%@",[_dataDic objectForKey:@"name"]];
    [infoBackView addSubview:tellerNameLable];
    
    //工号
    _numberLable = [[UILabel alloc]initWithFrame:CGRectMake(paddingToLeft, 20 + CGRectGetMaxY(_nameLable.frame),60, heightLable)];
    _numberLable.textColor = RGB(49, 49, 49);
    [_numberLable setFont:[UIFont fontWithName:@"Helvetica-Bold" size:20]];
    _numberLable.text = @"工号：";
    [infoBackView addSubview:_numberLable];
    //获取的员工工号
    UILabel *tellerNumLable = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_numberLable.frame),20 + CGRectGetMaxY(_nameLable.frame) , 80, heightLable)];
    tellerNumLable.textColor = RGB(24, 76, 149);
    [tellerNumLable setFont:[UIFont fontWithName:@"Helvetica-Bold" size:20]];
    tellerNumLable.text = [NSString stringWithFormat:@"%@",[_dataDic objectForKey:@"number"]];

    [infoBackView addSubview:tellerNumLable];
    
    //座右铭背景
    UIImageView *mottoBackView = [[UIImageView alloc]initWithImage:IMG(@"d")];
    mottoBackView.frame = CGRectMake(paddingToLeft, paddingTop+CGRectGetMaxY(infoBackView.frame), mottoBackView.frame.size.width, mottoBackView.frame.size.height);
    [self.view addSubview:mottoBackView];
    //座右铭
    LHRTLabel *remainIngotLabel = [[LHRTLabel alloc]initWithFrame:CGRectMake(20, 20,280, 130)];
    remainIngotLabel.text = [NSString stringWithFormat:@"座右铭：<font color=#184C95>%@</font>",[_dataDic objectForKey:@"note"]];
    [remainIngotLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:20]];
    [remainIngotLabel setTextColor:RGB(49, 49, 49)];
    [remainIngotLabel setTextAlignment:RTTextAlignmentLeft];
    [mottoBackView addSubview:remainIngotLabel];
    
    // 注销按钮
    UIButton *logoutBtn = [[UIButton alloc]initWithFrame:CGRectMake(paddingLeft, paddingTop, tellerImageBack.frame.size.width, tellerImageBack.frame.size.height)];
    [logoutBtn setImage:IMG(@"s1") forState:UIControlStateNormal];
    [logoutBtn addTarget:self action:@selector(logoutAct) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:logoutBtn];
}
-(void)logoutAct{
    

}

@end
